package com.jsy.mini12306.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.*;

import java.io.Serializable;


/**
 * 乘客表(Passenger)实体类
 *
 * @author: SongyangJi
 * @since: 2021-09-01 00:43:43
 * @description:
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Passenger implements Serializable {
    private static final long serialVersionUID = 805261892512847285L;
    /**
     * 雪花id
     */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using= ToStringSerializer.class)
    private Long passengerId;
    /**
     * 用户注册时的自选用户名（唯一）
     */
    private String userName;
    /**
     * 密码（加密后）
     */
    @JsonIgnore
    private String password;
    /**
     * 身份证号
     */
    private String idCard;
    /**
     * 真实姓名（用于身份核验）
     */
    private String name;
    /**
     * 手机号码
     */
    private String phoneNumber;
    /**
     * 电子邮箱
     */
    private String email;
    /**
     * 旅客类型
     */
    private PassengerType type;

    public static enum PassengerType {
        ADULT("成人"),
        CHILD("儿童"),
        STUDENT("学生"),
        SOLDIER("残军");

        @JsonValue
        @Getter
        private final String type;

        PassengerType(String type) {
            this.type = type;
        }


    }


}
